<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Platform Security Architecture — cryptography and keystore interface: Key management</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Platform Security Architecture — cryptography and keystore interface
   &#160;<span id="projectnumber">Working draft</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Key management</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gace37363530e2525a2562f07ceec8efb5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__key__management.html#gace37363530e2525a2562f07ceec8efb5">psa_import_key</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key, <a class="el" href="group__crypto__types.html#ga578159487dfc7096cb191b0d2befe628">psa_key_type_t</a> type, const uint8_t *data, size_t data_length)</td></tr>
<tr class="memdesc:gace37363530e2525a2562f07ceec8efb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Import a key in binary format.  <a href="#gace37363530e2525a2562f07ceec8efb5">More...</a><br /></td></tr>
<tr class="separator:gace37363530e2525a2562f07ceec8efb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2e9a60a9525ce6b3082a72df2080f0c5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__key__management.html#ga2e9a60a9525ce6b3082a72df2080f0c5">psa_destroy_key</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key)</td></tr>
<tr class="memdesc:ga2e9a60a9525ce6b3082a72df2080f0c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a key and restore the slot to its default state.  <a href="#ga2e9a60a9525ce6b3082a72df2080f0c5">More...</a><br /></td></tr>
<tr class="separator:ga2e9a60a9525ce6b3082a72df2080f0c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf105167657ab1d484cb4a51f93413717"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__key__management.html#gaf105167657ab1d484cb4a51f93413717">psa_get_key_information</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key, <a class="el" href="group__crypto__types.html#ga578159487dfc7096cb191b0d2befe628">psa_key_type_t</a> *type, size_t *bits)</td></tr>
<tr class="memdesc:gaf105167657ab1d484cb4a51f93413717"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get basic metadata about a key.  <a href="#gaf105167657ab1d484cb4a51f93413717">More...</a><br /></td></tr>
<tr class="separator:gaf105167657ab1d484cb4a51f93413717"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa67bc459b20028b268f3d75a05afe022"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__key__management.html#gaa67bc459b20028b268f3d75a05afe022">psa_export_key</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key, uint8_t *data, size_t data_size, size_t *data_length)</td></tr>
<tr class="memdesc:gaa67bc459b20028b268f3d75a05afe022"><td class="mdescLeft">&#160;</td><td class="mdescRight">Export a key in binary format.  <a href="#gaa67bc459b20028b268f3d75a05afe022">More...</a><br /></td></tr>
<tr class="separator:gaa67bc459b20028b268f3d75a05afe022"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7355b38f8eb9330db2786604f4a83a3b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__key__management.html#ga7355b38f8eb9330db2786604f4a83a3b">psa_export_public_key</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key, uint8_t *data, size_t data_size, size_t *data_length)</td></tr>
<tr class="memdesc:ga7355b38f8eb9330db2786604f4a83a3b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Export a public key or the public part of a key pair in binary format.  <a href="#ga7355b38f8eb9330db2786604f4a83a3b">More...</a><br /></td></tr>
<tr class="separator:ga7355b38f8eb9330db2786604f4a83a3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga2e9a60a9525ce6b3082a72df2080f0c5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2e9a60a9525ce6b3082a72df2080f0c5">&#9670;&nbsp;</a></span>psa_destroy_key()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_destroy_key </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroy a key and restore the slot to its default state. </p>
<p>This function destroys the content of the key slot from both volatile memory and, if applicable, non-volatile storage. Implementations shall make a best effort to ensure that any previous content of the slot is unrecoverable.</p>
<p>This function also erases any metadata such as policies. It returns the specified slot to its default state.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">key</td><td>The key slot to erase.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>The slot's content, if any, has been erased. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4d1b8dd8526177a15a210b7afc1accb1">PSA_ERROR_NOT_PERMITTED</a></td><td>The slot holds content and cannot be erased because it is read-only, either due to a policy or due to physical restrictions. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td>The specified slot number does not designate a valid slot. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td>There was an failure in communication with the cryptoprocessor. The key material may still be present in the cryptoprocessor. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#gadd169a1af2707862b95fb9df91dfc37d">PSA_ERROR_STORAGE_FAILURE</a></td><td>The storage is corrupted. Implementations shall make a best effort to erase key material even in this stage, however applications should be aware that it may be impossible to guarantee that the key material is not recoverable in such cases. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td>An unexpected condition which is not a storage corruption or a communication failure occurred. The cryptoprocessor may have been compromised. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaa67bc459b20028b268f3d75a05afe022"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa67bc459b20028b268f3d75a05afe022">&#9670;&nbsp;</a></span>psa_export_key()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_export_key </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>data_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Export a key in binary format. </p>
<p>The output of this function can be passed to <a class="el" href="group__key__management.html#gace37363530e2525a2562f07ceec8efb5" title="Import a key in binary format. ">psa_import_key()</a> to create an equivalent object.</p>
<p>If a key is created with <a class="el" href="group__key__management.html#gace37363530e2525a2562f07ceec8efb5" title="Import a key in binary format. ">psa_import_key()</a> and then exported with this function, it is not guaranteed that the resulting data is identical: the implementation may choose a different representation of the same key if the format permits it.</p>
<p>For standard key types, the output format is as follows:</p>
<ul>
<li>For symmetric keys (including MAC keys), the format is the raw bytes of the key.</li>
<li>For DES, the key data consists of 8 bytes. The parity bits must be correct.</li>
<li>For Triple-DES, the format is the concatenation of the two or three DES keys.</li>
<li>For RSA key pairs (<a class="el" href="group__crypto__types.html#ga581f50687f5d650456925278948f2799">PSA_KEY_TYPE_RSA_KEYPAIR</a>), the format is the non-encrypted DER representation defined by PKCS#1 (RFC 8017) as RSAPrivateKey.</li>
<li>For RSA public keys (<a class="el" href="group__crypto__types.html#ga9ba0878f56c8bcd1995ac017a74f513b">PSA_KEY_TYPE_RSA_PUBLIC_KEY</a>), the format is the DER representation defined by RFC 5280 as SubjectPublicKeyInfo.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">key</td><td>Slot whose content is to be exported. This must be an occupied key slot. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Buffer where the key data is to be written. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">data_size</td><td>Size of the <code>data</code> buffer in bytes. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data_length</td><td>On success, the number of bytes that make up the key data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#gaba00e3e6ceb2b12965a81e5ac02ae040">PSA_ERROR_EMPTY_SLOT</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4d1b8dd8526177a15a210b7afc1accb1">PSA_ERROR_NOT_PERMITTED</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga7355b38f8eb9330db2786604f4a83a3b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7355b38f8eb9330db2786604f4a83a3b">&#9670;&nbsp;</a></span>psa_export_public_key()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_export_public_key </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>data_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Export a public key or the public part of a key pair in binary format. </p>
<p>The output of this function can be passed to <a class="el" href="group__key__management.html#gace37363530e2525a2562f07ceec8efb5" title="Import a key in binary format. ">psa_import_key()</a> to create an object that is equivalent to the public key.</p>
<p>For standard key types, the output format is as follows:</p>
<ul>
<li>For RSA keys (<a class="el" href="group__crypto__types.html#ga581f50687f5d650456925278948f2799">PSA_KEY_TYPE_RSA_KEYPAIR</a> or <a class="el" href="group__crypto__types.html#ga9ba0878f56c8bcd1995ac017a74f513b">PSA_KEY_TYPE_RSA_PUBLIC_KEY</a>), the format is the DER representation of the public key defined by RFC 5280 as SubjectPublicKeyInfo.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">key</td><td>Slot whose content is to be exported. This must be an occupied key slot. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Buffer where the key data is to be written. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">data_size</td><td>Size of the <code>data</code> buffer in bytes. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data_length</td><td>On success, the number of bytes that make up the key data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#gaba00e3e6ceb2b12965a81e5ac02ae040">PSA_ERROR_EMPTY_SLOT</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaf105167657ab1d484cb4a51f93413717"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf105167657ab1d484cb4a51f93413717">&#9670;&nbsp;</a></span>psa_get_key_information()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_get_key_information </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__crypto__types.html#ga578159487dfc7096cb191b0d2befe628">psa_key_type_t</a> *&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>bits</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get basic metadata about a key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">key</td><td>Slot whose content is queried. This must be an occupied key slot. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">type</td><td>On success, the key type (a <code>PSA_KEY_TYPE_XXX</code> value). This may be a null pointer, in which case the key type is not written. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">bits</td><td>On success, the key size in bits. This may be a null pointer, in which case the key size is not written.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#gaba00e3e6ceb2b12965a81e5ac02ae040">PSA_ERROR_EMPTY_SLOT</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gace37363530e2525a2562f07ceec8efb5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gace37363530e2525a2562f07ceec8efb5">&#9670;&nbsp;</a></span>psa_import_key()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_import_key </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__crypto__types.html#ga578159487dfc7096cb191b0d2befe628">psa_key_type_t</a>&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Import a key in binary format. </p>
<p>This function supports any output from <a class="el" href="group__key__management.html#gaa67bc459b20028b268f3d75a05afe022" title="Export a key in binary format. ">psa_export_key()</a>. Refer to the documentation of <a class="el" href="group__key__management.html#gaa67bc459b20028b268f3d75a05afe022" title="Export a key in binary format. ">psa_export_key()</a> for the format for each key type.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">key</td><td>Slot where the key will be stored. This must be a valid slot for a key of the chosen type. It must be unoccupied. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">type</td><td>Key type (a <code>PSA_KEY_TYPE_XXX</code> value). </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>Buffer containing the key data. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">data_length</td><td>Size of the <code>data</code> buffer in bytes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td>Success. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td>The key type or key size is not supported, either by the implementation in general or in this particular slot. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td>The key slot is invalid, or the key data is not correctly formatted. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#gac2fee3a51249fbea45360aaa911f3e58">PSA_ERROR_OCCUPIED_SLOT</a></td><td>There is already a key in the specified slot. </td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga91b2ad8a867517a2651f1b076c5216e5">PSA_ERROR_INSUFFICIENT_MEMORY</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga897a45eb206a6f6b7be7ffbe36f0d766">PSA_ERROR_INSUFFICIENT_STORAGE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
